<?php
include "includes/sesiones.php";
include "includes/comunes.php";

if($_GET['eliminar']==1){
   
     $log=elimnar_creditos_log($_GET['cre_id']);
     $eli=eliminar_credito($_GET['cre_id']);
    header('Location: listadocreditos.php?sql='.$log);

    }



$sql="select * from creditos where id=".$_GET['cre_id'];
$rescre=  cons_ins($sql);
$regcre=mysql_fetch_array($rescre)


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<?php include "includes/metas.php";?>

<script language="JavaScript" type="text/javascript" src="combos/jquery.js"></script>



<link rel="stylesheet" type="text/css" href="modal/shadowbox.css"/>
<script type="text/javascript" src="modal/shadowbox.js"></script>
<script type="text/javascript">
Shadowbox.init({
    handleOversize: "drag",
    modal: true,
    displayNav:true
});
</script>

    <script languaje='javascript' type='text/javascript'>
function confirmar(){

         var seleccion = confirm("Esta seguro que desea eliminar el credito seleccionado?");

if (seleccion)
 document.form1.submit();
else
return seleccion;

        }
    </script>

<style>
#loading
{
	position:absolute;
	top:0px;
	right:0px;
	background:#ff0000;
	color:#fff;
	font-size:14px;
	font-familly:Arial;
	padding:2px;
	display:none;
}
</style>

</head>

<body>
    

<div class="contenedor">
    <div id="loading">abriendo ...</div>
	<div class="cont">
    	<?php include "includes/head.php";?>
        <?php include "includes/menu.php";?>
            
    	<div class="novedadescont">
             <form id="form1" name="form1" method="get" action="EliminarCreditos.php">
        	<div class="novedadestitulo">
            	<div class="menuvolver"> <a href="javascript:history.back(1)">Volver Atrás</a></div>
            </div>
                 <div class="novedadestitulo">
            	<div class="novetitulo2">Eliminar Credito Nº <?php echo $_GET['cre_id'] ?> ?</div>
            </div>
            <div class="formucont">
                
           	  <div class="formlinea">

                <div class="formtxt">Cliente</div>
                <div class="formtxt2">
                    <label for="form"></label>
                    <?php echo obtener_cliente($regcre['cliente'])?>
                  
                </div>
                
                </div>   
                
              <div class="formlinea">
                <div class="formtxt">Dni</div>
                <div class="formtxt2">
                 
                    <label for="form"></label>
                    <?php echo $regcre['cliente']?>
                </div>
                
                </div>
                
                
                
            
            
		
                         
            </div>           
            <div class="novedadestitulo">
            	<div class="novetitulo2">Dato de la Liquidacion</div>
            </div>
           <div class="formlinea">
                <div class="formtxt">Entidad Financiera</div>
                <div class="formtxt2">

                    <label for="form"></label>
                    
                        <?php
                         echo obtener_financiera($regcre['tipoCredito'])

                        ?>
                 
        
                </div>

                </div>

             <div class="formlinea">
                <div class="formtxt">Plan</div>
                <div class="formtxt2">

                 <?php
                         echo obtener_plan($regcre['tipoplan'])

                        ?>

                </div>

                </div>

              <div class="formlinea">
                <div class="formtxt">Tasa</div>
                <div class="formtxt2">

                    <label for="form"></label>

                    <?php
                         echo obtener_tasa_plan($regcre['tipoplan'])

                        ?>

                </div>

                </div>

               <div class="formlinea">
                <div class="formtxt">Amortizacion</div>
                <div class="formtxt2">

                    <label for="form"></label>
                  Simple

                </div>

                </div>

                 <div class="formlinea">
                <div class="formtxt">Autorizacion</div>
                <div class="formtxt2">

                    <label for="form"></label>
                  <?php
                         if($regcre['autorizacion']=="")
                                 echo "S/C";
                              else   
                                 echo $regcre['autorizacion'];

                        ?>

                </div>

                </div>
                   <div class="formlinea">
                <div class="formtxt">Gracia</div>
                <div class="formtxt2">

                    <label for="form"></label>
                  <?php
                         echo obtener_gracia_plan($regcre['tipoplan'])

                        ?>

                </div>

                </div>

                  <div class="formlinea">
                <div class="formtxt">Cuotas</div>
                <div class="formtxt2">

                    <label for="form"></label>
                   <?php
                         echo obtener_cuotas_plan($regcre['tipoplan'])

                        ?>

                </div>

                </div>

                  <div class="formlinea">
                <div class="formtxt">Monto</div>
                <div class="formtxt2">

                    <label for="form"></label>
                  <?php
                         echo "$ ".number_format($regcre['monto'])

                        ?>

                </div>

                </div>

                 <div class="formlinea">
                <div class="formtxt">Dia Vto</div>
                <div class="formtxt2">

                    <label for="form"></label>
                   <?php
                         echo $regcre['diaVto'];

                        ?>

                </div>

                </div>

                  <div class="formlinea">
                <div class="formtxt">Observacion</div>
                <div class="formtxt2">

                    <label for="form"></label>
                    <?php
                         if($regcre['observacion']=="")
                                 echo "- - - ";
                              else
                                 echo $regcre['observacion'];

                        ?>


                </div>

                </div>

                 <?php if(($regcre['estado'] == 1) and (verificar_pagos($_GET['cre_id']) < 1)):?>
                 <input name="cre_id" class="bot" type="hidden" value="<?php echo $_GET['cre_id']?>" />
                 <input name="eliminar" class="bot" type="hidden" value="1" />
                  <div style="float: center;padding-left: 280px;"><br> <input name="eliminar" class="bot"  type="button" value="Eliminar"  onclick="confirmar();" style="width:200px; background-color: red;border-left: 300px;"/><br></br></div>

                    <?php else:?>
                  <div style="float: left;padding-left: 230px;font-size:14px;font-weight:bold;font-family:Arial, Helvetica, sans-serif;color:red;">
                      No se puede Elimnar el Credito Seleccionado <br>ya que tiene pagos acreditados y esta aprobado.<br></br>
                  </div>


                    <?php endif?>



        	<div class="novedadesbottom"></div>
                </form>
        </div>
    
    
    
    
    <div class="separador"></div>
<?php include "includes/menufooter.php";?>
    
    
	<div id="clearing"></div>    
    </div>
<div id="clearing"></div>

 
</div>
    
</body>
</html>
